package de.mp3player.gui;

import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.*;

import de.mp3player.app.App;

public class LeftToolbar extends JPanel {
	
	private JButton favorits;
	private JButton harddisk;
	private JButton downloads;
	private JButton notes;
	private JButton people;
	private JButton sound;
	private JButton trash;
	private JButton web;
	private JScrollPane spane;
	private JPanel panel;
	
	public LeftToolbar(){
		this.harddisk = new JButton(App.makeIcon("/resources/emblem-shared.png"));
		this.favorits = new JButton(App.makeIcon("/resources/emblem-favorite.png"));
		this.downloads = new JButton(App.makeIcon("/resources/emblem-downloads.png"));
		this.notes = new JButton(App.makeIcon("/resources/emblem-note.png"));
		this.people = new JButton(App.makeIcon("/resources/emblem-people.png"));
		this.sound = new JButton(App.makeIcon("/resources/emblem-sound.png"));
		this.trash = new JButton(App.makeIcon("/resources/emblem-trash.png"));
		this.web = new JButton(App.makeIcon("/resources/emblem-web.png"));
		this.panel = new JPanel();
		initActions();
		setTooltips();
		buildPanel();
		this.spane = new JScrollPane(panel);
		add(spane);
	}
	private void initActions() {
		this.favorits.addActionListener(new ActionListener(){
			@Override
			public void actionPerformed(ActionEvent arg0) {
				// TODO LeftToolbar Favorits Button implementieren
				
			}
			
		});
		this.harddisk.addActionListener(new ActionListener(){
			@Override
			public void actionPerformed(ActionEvent arg0) {
				// TODO LeftToolbar Harddisk Button implementieren, wie kann man GuiElemente innerhalb eines Frames switchen?
				
			}
			
		});
		this.downloads.addActionListener(new ActionListener(){
			@Override
			public void actionPerformed(ActionEvent arg0) {
				// TODO LeftToolbar Download Button implementieren
				
			}
			
		});
		this.people.addActionListener(new ActionListener(){
			@Override
			public void actionPerformed(ActionEvent arg0) {
				// TODO LeftToolbar People Button implementieren
				
			}
			
		});
		this.notes.addActionListener(new ActionListener(){
			@Override
			public void actionPerformed(ActionEvent arg0) {
				// TODO LeftToolbar Notiz Button implementieren
				
			}
			
		});
		this.trash.addActionListener(new ActionListener(){
			@Override
			public void actionPerformed(ActionEvent arg0) {
				// TODO LeftToolbar Müll Button implementieren
				
			}
			
		});
		this.web.addActionListener(new ActionListener(){
			@Override
			public void actionPerformed(ActionEvent arg0) {
				// TODO LeftToolbar Web Button implementieren
				
			}
			
		});
		this.sound.addActionListener(new ActionListener(){
			@Override
			public void actionPerformed(ActionEvent arg0) {
				// TODO LeftToolbar Sound Button implementieren
				
			}
			
		});
		
	}
	private void setTooltips(){
		this.harddisk.setToolTipText("Festplatte anzeigen");
		this.favorits.setToolTipText("Ihre Favoriten Playlisten");
		this.downloads.setToolTipText("Ihre Downloads");
		this.notes.setToolTipText("Notizen zu den Songs");
		this.people.setToolTipText("Playlisten oder Songs mit Leuten teilen");
		this.sound.setToolTipText("Soundeinstellungen");
		this.trash.setToolTipText("Mülleimer");
		this.web.setToolTipText("Netzwerk");
	}
	private void buildPanel() {
		this.panel.setLayout(new  BoxLayout(panel,BoxLayout.PAGE_AXIS));	
		this.panel.add(favorits);
		this.panel.add(harddisk);
		this.panel.add(people);
		this.panel.add(sound);
		this.panel.add(web);
		this.panel.add(downloads);
		this.panel.add(notes);
		this.panel.add(trash);
	}
		
}
